OBJS = scanner.cmo parser.cmo hw1.cmo runtests.cmo

runtests : $(OBJS)
	ocamlc -o runtests $(OBJS)

scanner.ml : scanner.mll
	ocamllex scanner.mll

parser.ml parser.mli : parser.mly
	ocamlyacc parser.mly

%.cmo : %.ml
	ocamlc -c $<

%.cmi : %.mli
	ocamlc -c $<

TARFILES = Makefile ast.mli hw1.ml hw1.mli parser.mly scanner.mll runtests.ml \
	expected-output

hw1.tar.gz : $(TARFILES)
	cd .. && tar zcf hw1/$@ $(TARFILES:%=hw1/%)

.PHONY : clean
clean :
	rm -rf *.cmo *.cmi runtests parser.mli parser.ml scanner.ml

# generated by ocamldep *.ml *.mli
hw1-correct.cmo: scanner.cmo parser.cmi ast.cmi
hw1-correct.cmx: scanner.cmx parser.cmx ast.cmi
hw1.cmo: scanner.cmo parser.cmi ast.cmi hw1.cmi
hw1.cmx: scanner.cmx parser.cmx ast.cmi hw1.cmi
parser.cmo: ast.cmi parser.cmi
parser.cmx: ast.cmi parser.cmi
runtests.cmo: hw1.cmi
runtests.cmx: hw1.cmx
scanner.cmo: parser.cmi
scanner.cmx: parser.cmx
ast.cmi:
hw1.cmi: ast.cmi
parser.cmi: ast.cmi